import request from "@/utils/request";

export default {
  getList() {
    return request({
      url: "/staff/list",
      method: "get",
    });
  },
  //   分页
  search(page, size, searchMap) {
    return request({
      url: `/staff/list/search/${page}/${size}`,
      method: "post",
      data: searchMap,
    });
  },

  // 新增一个
  add(userdata) {
    return request({
      url: `/staff`,
      method: "post",
      data: userdata,
    });
  },

  // 根据id查询一条数据
  getById(id) {
    return request({
      url: `/staff/${id}`,
      method: "get",
    });
  },

  // 根据id编辑一条信息
  update(userdata) {
    return request({
      url: `/staff/${userdata.id}`,
      method: "put",
      data: userdata,
    });
  },
  // 删除一条信息
  delete(id) {
    return request({
      url: `/staff/${id}`,
      method: "delete",
    });
  },
};
